package com.opo5.logisticsmanagement.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.opo5.logisticsmanagement.dao.VehicleTasksDao;
import com.opo5.logisticsmanagement.domain.VehicleTasks;
import com.opo5.logisticsmanagement.service.VehicleTasksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VehicleTasksImpl extends ServiceImpl<VehicleTasksDao,VehicleTasks> implements VehicleTasksService {
    @Autowired
    private VehicleTasksDao vehicleTasksDao;

    @Override
    public int voList(int yy, int mm, int dd) {
        int res = 0;
        int myYY,myMM,myDD;
        List<String> list = vehicleTasksDao.findAll();
        for (String s:list){
            myYY = Integer.parseInt(s.substring(0,4));
            myMM = Integer.parseInt(s.substring(5,7));
            myDD = Integer.parseInt(s.substring(8,10));
            if (yy==myYY && mm==myMM && dd==myDD)res++;
        }
        return res;
    }
}
